home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Missions Cog Script
- #
- # POW_RAILSEEK_M.COG
- #
- # POWERUP Script - Seeking Rail Detonator
- #
- # [YB & CYW, RF]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
-
-
- symbols
-
- thing powerup local
- thing player local
-
- int bin=127 local
-
- # The seeker railgun is treated as a different weapon internally.
- int abin=137 local
-
- # The weapon order bin
- int wobin=17 local
-
- # Awards seeking rounds, not regular ones.
- int ammobin=91 local
- sound pickupsnd=powerpu1.wav local
- sound respawnsnd=Activate01.wav local
- flex amount local
-
- int bin_contents=0 local
- int autopickup=0 local
- int autosel=-1 local
-
- message touched
- message taken
- message respawn
-
- end
-
- # ========================================================================================
-
- code
-
- touched:
- player = GetSourceRef();
- if (GetThingType(player) == 10) // Can only be taken by players.
- {
- if(IsMulti() || (GetInv(player, bin) == 0) || (GetInv(player, ammobin) < GetInvMax(player, ammobin)))
- {
- TakeItem(GetSenderRef(), -1);
- call taken;
- }
- }
-
- Return;
-
- # ........................................................................................
-
- taken:
- player = GetSourceRef();
- powerup = GetSenderRef();
-
- // Do effects.
- PlaySoundLocal(pickupsnd, 1, 0, 0);
- AddDynamicTint(player, 0.0, 0.0, 0.2);
-
- if(GetInv(player, bin) == 0)
- {
- // Pickup gun and ammo.
- // Print("Rail Detonator");
- jkPrintUNIString(player, abin);
-
- ChangeInv(player, bin, 1.0);
- ChangeInv(player, abin, 1.0);
- ChangeInv(player, ammobin, 6.0);
-
- // Check for Auto Pickup
- autopickup = GetAutoPickup();
- if((autopickup & 1) && !(autopickup & 2)) // DANGEROUS
- {
- if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, abin, 0))))
- {
- if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
- {
- SelectWeapon(player, abin);
- Return;
- }
- }
- }
- }
- else
- if(GetInv(player, ammobin) < GetInvMax(player, ammobin))
- {
- // Pickup ammo only.
- // Print("Rail Charges");
- jkPrintUNIString(player, ammobin);
-
- // store the old bin contents
- bin_contents = GetInv(player, ammobin);
-
- ChangeInv(player, abin, 1.0);
- ChangeInv(player, ammobin, 6.0);
-
- // Check for Auto Reload
- if(GetAutoReload() & 1)
- {
- if(!bin_contents)
- {
- if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
- {
- // Try to autoselect and see if the best weapon is the railgun
- if(AutoSelectWeapon(player, 2) == wobin) SelectWeapon(player, wobin);
- }
- }
- }
- }
-
- Return;
-
- # ........................................................................................
-
- respawn:
- PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
-
- Return;
-
- end
-